<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Cancels a request</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.eio-busy.html">« eio_busy</a></li>
      <li style="float: right;"><a href="function.eio-chmod.html">eio_chmod »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.eio.html">Eio 函数</a></li>
    <li>Cancels a request</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.eio-cancel" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">eio_cancel</h1>
  <p class="verinfo">(PECL eio &gt;= 0.0.1dev)</p><p class="refpurpose"><span class="refname">eio_cancel</span> &mdash; <span class="dc-title">Cancels a request</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.eio-cancel-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>eio_cancel</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$req</code></span>): <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>eio_cancel()</strong></span> cancels a request specified by
   <code class="parameter">req</code>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.eio-cancel-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">req</code></dt>

    <dd>

     <p class="para">
     The request resource
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">pri</code></dt>

    <dd>

    <p class="para">请求的优先级：<strong><code>EIO_PRI_DEFAULT</code></strong>，<strong><code>EIO_PRI_MIN</code></strong>，<strong><code>EIO_PRI_MAX</code></strong> 或 <strong><code>null</code></strong>。如果是
<strong><code>null</code></strong>，<code class="parameter">pri</code> 将设为
<strong><code>EIO_PRI_DEFAULT</code></strong>。
</p>

    </dd>

   
   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
<code class="parameter">callback</code>
函数在请求完成时被调用。其应匹配一下原型：<div class="example-contents"><div class="phpcode"><code><span style="color: #000000">
void&nbsp;callback(mixed&nbsp;$data,&nbsp;int&nbsp;$result[,&nbsp;resource&nbsp;$req]);</span>
</code></div></div>

<dl>
 
  <dt>
<code class="parameter">data</code></dt>

  <dd>
<p class="para">传递给请求的用户数据。</p></dd>

 
 
  <dt>
<code class="parameter">result</code></dt>

  <dd>
<p class="para">针对请求的结果的值。通常是相应的系统调用返回的值。</p></dd>

 
 
  <dt>
<code class="parameter">req</code></dt>

  <dd>
<p class="para">可选的请求资源，可被 <span class="function"><a href="function.eio-get-last-error.html" class="function">eio_get_last_error()</a></span>
   之类的函数使用。</p></dd>

 
</dl>

</p>

    </dd>

   
   
    <dt>
<code class="parameter">data</code></dt>

    <dd>

     <p class="para">
     Arbitrary variable passed to <code class="parameter">callback</code>.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.eio-cancel-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
  没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.eio-cancel-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-3219">
   <p><strong>示例 #1 <span class="function"><strong>eio_cancel()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />&nbsp;</span><span style="color: #FF8000">/*&nbsp;Is&nbsp;called&nbsp;when&nbsp;eio_nop()&nbsp;finished&nbsp;*/<br />&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">my_nop_cb</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"my_nop&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;}<br /><br /></span><span style="color: #FF8000">//&nbsp;This&nbsp;eio_nop()&nbsp;call&nbsp;will&nbsp;be&nbsp;cancelled<br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_nop_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_cancel</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;This&nbsp;time&nbsp;eio_nop()&nbsp;will&nbsp;be&nbsp;processed<br /></span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_nop_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"2"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Process&nbsp;requests<br /></span><span style="color: #0000BB">eio_event_loop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
resource(4) of type (EIO Request Descriptor)
my_nop 2
</pre></div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.eio-cancel-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.eio-grp-cancel.html" class="function" rel="rdfs-seeAlso">eio_grp_cancel()</a> - Cancels a request group</span></li>
  </ul>
 </div>


</div></div></div></body></html>